// Copyright 2022 a.o.smith ALL Rights Reserved
package com.liuxinlong.enums;

import org.apache.commons.lang3.StringUtils;

/**
 * 资产种类枚举
 *
 * @author liuxinlong@hotwater.com.cn
 * @version 1.0.0
 * @since 2023-11-07
 */
public enum AssetsTypeEnum {
    BUILDING_CONSTRUCTION(1, "房屋建筑类(不动产)", 50),
    COURTYARD(2, "院落类", 15),
    HOUSING_EQUIPMENT(3, "房屋设备", 25),
    RENOVATION_SELF_HOUSES(4, "自有房屋装修", 10),
    DECORATION(5, "装修类", 3),
    PRODUCTION_MACHINE(6, "生产机器", 16),
    NON_PRODUCTION_MACHINE(7, "非生产机械设备", 8),
    NON_PRODUCTION_ELECTRONIC(8, "非生产电子设备", 8),
    VEHICLE(9, "车辆", 5),
    OFFICE_EQUIPMENT(10, "办公设备(含IT设备)", 5),
    COMPUTER(11, "电脑", 3),
    SOFTWARE(12, "软件", 5),
    PRODUCTION_TOOL(13, "生产工具", 3),
    OWN_MOLD(14, "自有模具", 3),
    OUTSOURCING_MOLD(15, "委外模具", 3),
    VEHICLE_BUS(16, "车辆-客车", 0),
    VEHICLE_TRUCK(17, "车辆-运输车", 0);

    private int value;

    private String name;

    private int depreciation;

    AssetsTypeEnum(int value, String name, int depreciation) {
        this.value = value;
        this.name = name;
        this.depreciation = depreciation;
    }

    public int getValue() {
        return value;
    }

    public String getName() {
        return name;
    }

    public int getDepreciation() {
        return depreciation;
    }

    public static String getNameByValue(int value) {
        AssetsTypeEnum arrObj[] = AssetsTypeEnum.values();
        for (AssetsTypeEnum obj : arrObj) {
            if (value == obj.getValue()) {
                return obj.getName();
            }
        }
        return " ";
    }

    public static int getValueByName(String name) {
        AssetsTypeEnum arrObj[] = AssetsTypeEnum.values();
        for (AssetsTypeEnum obj : arrObj) {
            if (StringUtils.equals(name, obj.getName())) {
                return obj.getValue();
            }
        }
        return 0;
    }

    public static int getDepreciationByValue(int value) {
        AssetsTypeEnum arrObj[] = AssetsTypeEnum.values();
        for (AssetsTypeEnum obj : arrObj) {
            if (value == obj.getValue()) {
                return obj.getDepreciation();
            }
        }
        return 0;
    }

    public static int getDepreciationByName(String name) {
        AssetsTypeEnum arrObj[] = AssetsTypeEnum.values();
        for (AssetsTypeEnum obj : arrObj) {
            if (StringUtils.equals(name,obj.getName())) {
                return obj.getDepreciation();
            }
        }
        return 0;
    }

}
